package com.ml.enums;

import java.util.Arrays;
import java.util.Optional;

public enum RequestType {
    KLINE("kline", "K线"),
    TRADE("trade", "实时成交"),
    SYMBOLS("symbols", "交易对");

    public final String value;
    public final String name;

    RequestType(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public static Optional<RequestType> of(String value) {
        return Arrays.stream(values()).filter(i -> i.value.equals(value)).findFirst();
    }
}
